import json

with open("cases_pool.json") as fin:
    data_dict = json.load(fin)

with open("feature.json") as fin:
    feature_dict = {} 
    for line in fin:
        line = line.strip()
        line_dict = json.loads(line)
        feature_dict[line_dict["index"]] = line_dict["feature"]

new_data_dict = {}


for key, value_dict in data_dict.items():
    new_value = {}
    new_value["caseID"] = value_dict["caseID"]
    new_value["content"] = value_dict["content"]["本院查明"]
    new_value["feature"] = feature_dict[str(value_dict["uid"])]
    new_data_dict[value_dict["uid"]] = new_value
    
with open("candidate.json", 'w') as fout:
    json.dump(new_data_dict, fout, ensure_ascii=False, indent=4)